#include <iostream>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>

void handler(int sig)
{
    std::cout << "接收到信号: " << sig << std::endl;
}
int main()
{
    for (int i = 1; i < 32; i++)
    {
        signal(i, handler);
    }
    int cnt = 0;
    while (true)
    {
        std::cout << "hello sig!" << "pid: "  << getpid() << std::endl;
        sleep(1);
    }
    return 0;
}